DE

[Resolvido] Fazer msg aparecer somente no registro do server código c++

Por Developer Berg, 01 de ago. de 2018 em Resolvidos

10
2.1k
Developer BergD
01 de agosto de 2018 às 12:28

olá galerinha, queria fazer uma pergunta simples. como posso passar a mensagem de quando o play upa 1 lvl para apenas aparecer no registro do server? ela está aparecendo na tela acima do player e tbm está aparecendo no registro do server.

SMsxT7b.png

a parte do código tá aqui

Spoiler
void Player::addExperience(uint64_t exp)
{
	uint32_t prevLevel = level;
	uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
	if(Player::getExpForLevel(level) > nextLevelExp)
	{
		//player has reached max level
		levelPercent = 0;
		sendStats();
		return;
	}

	experience += exp;
	while(experience >= nextLevelExp)
	{
		healthMax += vocation->getGain(GAIN_HEALTH);
		health += vocation->getGain(GAIN_HEALTH);
		manaMax += vocation->getGain(GAIN_MANA);
		mana += vocation->getGain(GAIN_MANA);
		capacity += vocation->getGainCap();

		++level;
		nextLevelExp = Player::getExpForLevel(level + 1);
		if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level
			break;
	}

	if(prevLevel != level)
	{
		updateBaseSpeed();
		setBaseSpeed(getBaseSpeed());

		g_game.changeSpeed(this, 0);
		g_game.addCreatureHealth(this);
		if(getParty())
			getParty()->updateSharedExperience();

		char advMsg[60];
		sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
		sendTextMessage(advMsg);

		CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
		for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
			(*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);
	}

	uint64_t currLevelExp = Player::getExpForLevel(level);
	nextLevelExp = Player::getExpForLevel(level + 1);
	levelPercent = 0;
	if(nextLevelExp > currLevelExp)
		levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);

	sendStats();
}

 

mais especificamente

Spoiler
char advMsg[60];
		sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
		sendTextMessage(advMsg);

 

 

01 de agosto de 2018 às 13:24
55 minutos atrás, ricardoberg disse:

olá galerinha, queria fazer uma pergunta simples. como posso passar a mensagem de quando o play upa 1 lvl para apenas aparecer no registro do server? ela está aparecendo na tela acima do player e tbm está aparecendo no registro do server.

SMsxT7b.png

a parte do código tá aqui

  Mostrar conteúdo oculto

void Player::addExperience(uint64_t exp)
{
	uint32_t prevLevel = level;
	uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
	if(Player::getExpForLevel(level) > nextLevelExp)
	{
		//player has reached max level
		levelPercent = 0;
		sendStats();
		return;
	}

	experience += exp;
	while(experience >= nextLevelExp)
	{
		healthMax += vocation->getGain(GAIN_HEALTH);
		health += vocation->getGain(GAIN_HEALTH);
		manaMax += vocation->getGain(GAIN_MANA);
		mana += vocation->getGain(GAIN_MANA);
		capacity += vocation->getGainCap();

		++level;
		nextLevelExp = Player::getExpForLevel(level + 1);
		if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level
			break;
	}

	if(prevLevel != level)
	{
		updateBaseSpeed();
		setBaseSpeed(getBaseSpeed());

		g_game.changeSpeed(this, 0);
		g_game.addCreatureHealth(this);
		if(getParty())
			getParty()->updateSharedExperience();

		char advMsg[60];
		sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
		sendTextMessage(advMsg);

		CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
		for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
			(*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);
	}

	uint64_t currLevelExp = Player::getExpForLevel(level);
	nextLevelExp = Player::getExpForLevel(level + 1);
	levelPercent = 0;
	if(nextLevelExp > currLevelExp)
		levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);

	sendStats();
}

 

mais especificamente

  Ocultar conteúdo

char advMsg[60];
		sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
		sendTextMessage(advMsg);

 

 

Tenta mudar:

sendTextMessage(advMsg); 

para

sendTextMessage(MSG_STATUS_DEFAULT, advMsg);

Developer BergD
01 de agosto de 2018 às 13:26
2 minutos atrás, Refe disse:

Tenta mudar:

 

sendTextMessage(advMsg); 

 

para

 

sendTextMessage(MSG_STATUS_DEFAULT, advMsg);

 

já tentei fazer isso. fica do msm jeito, aparecendo na tela acima do player e no registro do server

01 de agosto de 2018 às 13:28
Melhor resposta
Agora, ricardoberg disse:

já tentei fazer isso. fica do msm jeito, aparecendo na tela acima do player e no registro do server

Tenta essa classe:

MSG_STATUS_CONSOLE_BLUE

Developer BergD
01 de agosto de 2018 às 13:54
25 minutos atrás, Refe disse:

Tenta essa classe:

MSG_STATUS_CONSOLE_BLUE

vlw, funcionou. rep+ ^^

01 de agosto de 2018 às 13:57

Pode fechar ?

Developer BergD
01 de agosto de 2018 às 13:59
1 minuto atrás, Refe disse:

Pode fechar ?

sim, pode. só 1 duvida, se eu colocar para MSG_STATUS_CONSOLE_RED. para sair red em vez de blue funciona ?

01 de agosto de 2018 às 14:00

Tem que ver em const.h

As classes de mensagem existentes

Developer BergD
01 de agosto de 2018 às 14:01
1 minuto atrás, Refe disse:

Tem que ver em const.h

As classes de mensagem existentes

blz, vou dá uma olhada aqui. pode fechar. obrigado

01 de agosto de 2018 às 14:02
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.